home *** CD-ROM | disk | FTP | other *** search
Wrap
package javax.swing.plaf.basic; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; import java.awt.IllegalComponentStateException; import java.awt.Insets; import java.awt.Polygon; import java.awt.Rectangle; import java.awt.event.ComponentListener; import java.awt.event.FocusListener; import java.beans.PropertyChangeListener; import java.util.Dictionary; import java.util.Enumeration; import javax.swing.JComponent; import javax.swing.JSlider; import javax.swing.KeyStroke; import javax.swing.LookAndFeel; import javax.swing.SwingUtilities; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.event.ChangeListener; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.SliderUI; public class BasicSliderUI extends SliderUI { public final int POSITIVE_SCROLL = 1; public final int NEGATIVE_SCROLL = -1; public final int MIN_SCROLL = -2; public final int MAX_SCROLL = 2; protected Timer scrollTimer; protected JSlider slider; protected Insets focusInsets = null; protected Insets insetCache = null; protected Rectangle focusRect = null; protected Rectangle contentRect = null; protected Rectangle labelRect = null; protected Rectangle tickRect = null; protected Rectangle trackRect = null; protected Rectangle thumbRect = null; protected int trackBuffer = 0; private static final Dimension PREFERRED_HORIZONTAL_SIZE = new Dimension(200, 21); private static final Dimension PREFERRED_VERTICAL_SIZE = new Dimension(21, 200); private static final Dimension MINIMUM_HORIZONTAL_SIZE = new Dimension(36, 21); private static final Dimension MINIMUM_VERTICAL_SIZE = new Dimension(21, 36); private transient boolean isDragging; protected TrackListener trackListener; protected ChangeListener changeListener; protected ComponentListener componentListener; protected FocusListener focusListener; protected ScrollListener scrollListener; protected PropertyChangeListener propertyChangeListener; private Color shadowColor; private Color highlightColor; private Color focusColor; private static Rectangle unionRect = new Rectangle(); public BasicSliderUI(JSlider var1) { } // $FF: synthetic method static boolean access$0(BasicSliderUI var0) { return var0.isDragging; } // $FF: synthetic method static void access$1(BasicSliderUI var0, boolean var1) { var0.isDragging = var1; } protected void calculateContentRect() { this.contentRect.x = this.focusRect.x + this.focusInsets.left; this.contentRect.y = this.focusRect.y + this.focusInsets.top; this.contentRect.width = this.focusRect.width - (this.focusInsets.left + this.focusInsets.right); this.contentRect.height = this.focusRect.height - (this.focusInsets.top + this.focusInsets.bottom); } protected void calculateFocusRect() { this.focusRect.x = this.insetCache.left; this.focusRect.y = this.insetCache.top; this.focusRect.width = this.slider.getWidth() - (this.insetCache.left + this.insetCache.right); this.focusRect.height = this.slider.getHeight() - (this.insetCache.top + this.insetCache.bottom); } protected void calculateGeometry() { this.calculateFocusRect(); this.calculateContentRect(); this.calculateThumbSize(); this.calculateTrackBuffer(); this.calculateTrackRect(); this.calculateTickRect(); this.calculateLabelRect(); this.calculateThumbLocation(); } protected void calculateLabelRect() { if (this.slider.getPaintLabels()) { if (this.slider.getOrientation() == 0) { this.labelRect.x = this.tickRect.x - this.trackBuffer; this.labelRect.y = this.tickRect.y + this.tickRect.height; this.labelRect.width = this.tickRect.width + this.trackBuffer * 2; this.labelRect.height = this.getHeightOfTallestLabel(); } else { this.labelRect.x = this.tickRect.x + this.tickRect.width; this.labelRect.y = this.tickRect.y - this.trackBuffer; this.labelRect.width = this.getWidthOfWidestLabel(); this.labelRect.height = this.tickRect.height + this.trackBuffer * 2; } } else if (this.slider.getOrientation() == 0) { this.labelRect.x = this.tickRect.x; this.labelRect.y = this.tickRect.y + this.tickRect.height; this.labelRect.width = this.tickRect.width; this.labelRect.height = 0; } else { this.labelRect.x = this.tickRect.x + this.tickRect.width; this.labelRect.y = this.tickRect.y; this.labelRect.width = 0; this.labelRect.height = this.tickRect.height; } } protected void calculateThumbLocation() { if (this.slider.getSnapToTicks()) { int var1 = this.slider.getValue(); int var2 = var1; int var3 = this.slider.getMajorTickSpacing(); int var4 = this.slider.getMinorTickSpacing(); int var5 = 0; if (var4 > 0) { var5 = var4; } else if (var3 > 0) { var5 = var3; } if (var5 != 0) { if ((var1 - this.slider.getMinimum()) % var5 != 0) { float var6 = (float)(var1 - this.slider.getMinimum()) / (float)var5; int var7 = Math.round(var6); var2 = this.slider.getMinimum() + var7 * var5; } if (var2 != var1) { this.slider.setValue(var2); } } } if (this.slider.getOrientation() == 0) { int var8 = this.xPositionForValue(this.slider.getValue()); this.thumbRect.x = var8 - this.thumbRect.width / 2; this.thumbRect.y = this.trackRect.y; } else { int var9 = this.yPositionForValue(this.slider.getValue()); this.thumbRect.x = this.trackRect.x; this.thumbRect.y = var9 - this.thumbRect.height / 2; } } protected void calculateThumbSize() { Dimension var1 = this.getThumbSize(); this.thumbRect.setSize(var1.width, var1.height); } protected void calculateTickRect() { if (this.slider.getOrientation() == 0) { this.tickRect.x = this.trackRect.x; this.tickRect.y = this.trackRect.y + this.trackRect.height; this.tickRect.width = this.trackRect.width; this.tickRect.height = this.getTickLength(); if (!this.slider.getPaintTicks()) { --this.tickRect.y; this.tickRect.height = 0; } } else { this.tickRect.x = this.trackRect.x + this.trackRect.width; this.tickRect.y = this.trackRect.y; this.tickRect.width = this.getTickLength(); this.tickRect.height = this.trackRect.height; if (!this.slider.getPaintTicks()) { --this.tickRect.x; this.tickRect.width = 0; } } } protected void calculateTrackBuffer() { if (this.slider.getPaintLabels() && this.slider.getLabelTable() != null) { Component var1 = this.getHighestValueLabel(); Component var2 = this.getLowestValueLabel(); if (this.slider.getOrientation() == 0) { this.trackBuffer = Math.max(var1.getBounds().width, var2.getBounds().width) / 2; this.trackBuffer = Math.max(this.trackBuffer, this.thumbRect.width / 2); } else { this.trackBuffer = Math.max(var1.getBounds().height, var2.getBounds().height) / 2; this.trackBuffer = Math.max(this.trackBuffer, this.thumbRect.height / 2); } } else if (this.slider.getOrientation() == 0) { this.trackBuffer = this.thumbRect.width / 2; } else { this.trackBuffer = this.thumbRect.height / 2; } } protected void calculateTrackRect() { if (this.slider.getOrientation() == 0) { this.trackRect.x = this.contentRect.x + this.trackBuffer; this.trackRect.y = this.contentRect.y; this.trackRect.width = this.contentRect.width - this.trackBuffer * 2; this.trackRect.height = this.thumbRect.height; } else { this.trackRect.x = this.contentRect.x; this.trackRect.y = this.contentRect.y + this.trackBuffer; this.trackRect.width = this.thumbRect.width; this.trackRect.height = this.contentRect.height - this.trackBuffer * 2; } } protected ChangeListener createChangeListener(JSlider var1) { return new ChangeHandler(this); } protected ComponentListener createComponentListener(JSlider var1) { return new ComponentHandler(this); } protected FocusListener createFocusListener(JSlider var1) { return new FocusHandler(this); } protected PropertyChangeListener createPropertyChangeListener(JSlider var1) { return new PropertyChangeHandler(this); } protected ScrollListener createScrollListener(JSlider var1) { return new ScrollListener(this); } protected TrackListener createTrackListener(JSlider var1) { return new TrackListener(this); } public static ComponentUI createUI(JComponent var0) { return new BasicSliderUI((JSlider)var0); } protected Color getFocusColor() { return this.focusColor; } protected int getHeightOfHighValueLabel() { Component var1 = this.getHighestValueLabel(); int var2 = 0; if (var1 != null) { var2 = var1.getPreferredSize().height; } return var2; } protected int getHeightOfLowValueLabel() { Component var1 = this.getLowestValueLabel(); int var2 = 0; if (var1 != null) { var2 = var1.getPreferredSize().height; } return var2; } protected int getHeightOfTallestLabel() { Dictionary var1 = this.slider.getLabelTable(); int var2 = 0; Component var4; if (var1 != null) { for(Enumeration var3 = var1.keys(); var3.hasMoreElements(); var2 = Math.max(var4.getPreferredSize().height, var2)) { var4 = (Component)var1.get(var3.nextElement()); } } return var2; } protected Component getHighestValueLabel() { Dictionary var1 = this.slider.getLabelTable(); Component var2 = null; if (var1 != null) { Enumeration var3 = var1.keys(); if (var3.hasMoreElements()) { int var4; int var5; for(var4 = (Integer)var3.nextElement(); var3.hasMoreElements(); var4 = Math.max(var5, var4)) { var5 = (Integer)var3.nextElement(); } var2 = (Component)var1.get(new Integer(var4)); } } return var2; } protected Color getHighlightColor() { return this.highlightColor; } protected Component getLowestValueLabel() { Dictionary var1 = this.slider.getLabelTable(); Component var2 = null; if (var1 != null) { Enumeration var3 = var1.keys(); if (var3.hasMoreElements()) { int var4; int var5; for(var4 = (Integer)var3.nextElement(); var3.hasMoreElements(); var4 = Math.min(var5, var4)) { var5 = (Integer)var3.nextElement(); } var2 = (Component)var1.get(new Integer(var4)); } } return var2; } public Dimension getMaximumSize(JComponent var1) { Dimension var2 = this.getPreferredSize(var1); if (this.slider.getOrientation() == 1) { var2.height = 32767; } else { var2.width = 32767; } return var2; } public Dimension getMinimumHorizontalSize() { return MINIMUM_HORIZONTAL_SIZE; } public Dimension getMinimumSize(JComponent var1) { this.recalculateIfInsetsChanged(); Dimension var2; if (this.slider.getOrientation() == 1) { var2 = new Dimension(this.getMinimumVerticalSize()); var2.width = this.insetCache.left + this.insetCache.right; var2.width += this.focusInsets.left + this.focusInsets.right; var2.width += this.trackRect.width + this.tickRect.width + this.labelRect.width; } else { var2 = new Dimension(this.getMinimumHorizontalSize()); var2.height = this.insetCache.top + this.insetCache.bottom; var2.height += this.focusInsets.top + this.focusInsets.bottom; var2.height += this.trackRect.height + this.tickRect.height + this.labelRect.height; } return var2; } public Dimension getMinimumVerticalSize() { return MINIMUM_VERTICAL_SIZE; } public Dimension getPreferredHorizontalSize() { return PREFERRED_HORIZONTAL_SIZE; } public Dimension getPreferredSize(JComponent var1) { this.recalculateIfInsetsChanged(); Dimension var2; if (this.slider.getOrientation() == 1) { var2 = new Dimension(this.getPreferredVerticalSize()); var2.width = this.insetCache.left + this.insetCache.right; var2.width += this.focusInsets.left + this.focusInsets.right; var2.width += this.trackRect.width + this.tickRect.width + this.labelRect.width; } else { var2 = new Dimension(this.getPreferredHorizontalSize()); var2.height = this.insetCache.top + this.insetCache.bottom; var2.height += this.focusInsets.top + this.focusInsets.bottom; var2.height += this.trackRect.height + this.tickRect.height + this.labelRect.height; } return var2; } public Dimension getPreferredVerticalSize() { return PREFERRED_VERTICAL_SIZE; } protected Color getShadowColor() { return this.shadowColor; } protected Dimension getThumbSize() { Dimension var1 = new Dimension(); if (this.slider.getOrientation() == 1) { var1.width = 20; var1.height = 11; } else { var1.width = 11; var1.height = 20; } return var1; } protected int getTickLength() { return 8; } protected int getWidthOfHighValueLabel() { Component var1 = this.getHighestValueLabel(); int var2 = 0; if (var1 != null) { var2 = var1.getPreferredSize().width; } return var2; } protected int getWidthOfLowValueLabel() { Component var1 = this.getLowestValueLabel(); int var2 = 0; if (var1 != null) { var2 = var1.getPreferredSize().width; } return var2; } protected int getWidthOfWidestLabel() { Dictionary var1 = this.slider.getLabelTable(); int var2 = 0; Component var4; if (var1 != null) { for(Enumeration var3 = var1.keys(); var3.hasMoreElements(); var2 = Math.max(var4.getPreferredSize().width, var2)) { var4 = (Component)var1.get(var3.nextElement()); } } return var2; } protected void installDefaults(JSlider var1) { LookAndFeel.installBorder(var1, "Slider.border"); LookAndFeel.installColors(var1, "Slider.background", "Slider.foreground"); this.highlightColor = UIManager.getColor("Slider.highlight"); this.shadowColor = UIManager.getColor("Slider.shadow"); this.focusColor = UIManager.getColor("Slider.focus"); this.focusInsets = (Insets)UIManager.get("Slider.focusInsets"); } protected void installKeyboardActions(JSlider var1) { ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, 1, false), KeyStroke.getKeyStroke(39, 0), 0); ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, 1, false), KeyStroke.getKeyStroke("KP_RIGHT"), 0); ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, -1, false), KeyStroke.getKeyStroke(40, 0), 0); ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, -1, false), KeyStroke.getKeyStroke("KP_DOWN"), 0); ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, -1, true), KeyStroke.getKeyStroke(34, 0), 0); ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, -1, false), KeyStroke.getKeyStroke(37, 0), 0); ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, -1, false), KeyStroke.getKeyStroke("KP_LEFT"), 0); ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, 1, false), KeyStroke.getKeyStroke(38, 0), 0); ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, 1, false), KeyStroke.getKeyStroke("KP_UP"), 0); ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, 1, true), KeyStroke.getKeyStroke(33, 0), 0); ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, -2, true), KeyStroke.getKeyStroke(36, 0), 0); ((JComponent)var1).registerKeyboardAction(new ActionScroller(this, var1, 2, true), KeyStroke.getKeyStroke(35, 0), 0); } protected void installListeners(JSlider var1) { ((Component)var1).addMouseListener(this.trackListener); ((Component)var1).addMouseMotionListener(this.trackListener); ((Component)var1).addFocusListener(this.focusListener); ((Component)var1).addComponentListener(this.componentListener); ((JComponent)var1).addPropertyChangeListener(this.propertyChangeListener); var1.getModel().addChangeListener(this.changeListener); } public void installUI(JComponent var1) { this.slider = (JSlider)var1; this.slider.setEnabled(this.slider.isEnabled()); this.slider.setOpaque(true); this.isDragging = false; this.trackListener = this.createTrackListener(this.slider); this.changeListener = this.createChangeListener(this.slider); this.componentListener = this.createComponentListener(this.slider); this.focusListener = this.createFocusListener(this.slider); this.scrollListener = this.createScrollListener(this.slider); this.propertyChangeListener = this.createPropertyChangeListener(this.slider); this.installDefaults(this.slider); this.installListeners(this.slider); this.installKeyboardActions(this.slider); this.scrollTimer = new Timer(100, this.scrollListener); this.scrollTimer.setInitialDelay(300); this.insetCache = this.slider.getInsets(); this.focusRect = new Rectangle(); this.contentRect = new Rectangle(); this.labelRect = new Rectangle(); this.tickRect = new Rectangle(); this.trackRect = new Rectangle(); this.thumbRect = new Rectangle(); this.calculateGeometry(); } public void paint(Graphics var1, JComponent var2) { this.recalculateIfInsetsChanged(); Rectangle var3 = var1.getClipBounds(); if (this.slider.getPaintTrack() && var3.intersects(this.trackRect)) { this.paintTrack(var1); } if (this.slider.getPaintTicks() && var3.intersects(this.tickRect)) { this.paintTicks(var1); } if (this.slider.getPaintLabels() && var3.intersects(this.labelRect)) { this.paintLabels(var1); } if (this.slider.hasFocus() && var3.intersects(this.focusRect)) { this.paintFocus(var1); } if (var3.intersects(this.thumbRect)) { this.paintThumb(var1); } } public void paintFocus(Graphics var1) { var1.setColor(this.getFocusColor()); BasicGraphicsUtils.drawDashedRect(var1, this.focusRect.x, this.focusRect.y, this.focusRect.width, this.focusRect.height); } protected void paintHorizontalLabel(Graphics var1, int var2, Component var3) { int var4 = this.xPositionForValue(var2); int var5 = var4 - var3.getPreferredSize().width / 2; var1.translate(var5, 0); var3.paint(var1); var1.translate(-var5, 0); } public void paintLabels(Graphics var1) { Rectangle var2 = this.labelRect; Dictionary var3 = this.slider.getLabelTable(); if (var3 != null) { Enumeration var4 = var3.keys(); while(var4.hasMoreElements()) { Integer var5 = (Integer)var4.nextElement(); Component var6 = (Component)var3.get(var5); if (this.slider.getOrientation() == 0) { var1.translate(0, var2.y); this.paintHorizontalLabel(var1, var5, var6); var1.translate(0, -var2.y); } else { var1.translate(var2.x, 0); this.paintVerticalLabel(var1, var5, var6); var1.translate(-var2.x, 0); } } } } protected void paintMajorTickForHorizSlider(Graphics var1, Rectangle var2, int var3) { var1.drawLine(var3, 0, var3, var2.height - 2); } protected void paintMajorTickForVertSlider(Graphics var1, Rectangle var2, int var3) { var1.drawLine(0, var3, var2.width - 2, var3); } protected void paintMinorTickForHorizSlider(Graphics var1, Rectangle var2, int var3) { var1.drawLine(var3, 0, var3, var2.height / 2 - 1); } protected void paintMinorTickForVertSlider(Graphics var1, Rectangle var2, int var3) { var1.drawLine(0, var3, var2.width / 2 - 1, var3); } public void paintThumb(Graphics var1) { Rectangle var2 = this.thumbRect; int var3 = var2.width; int var4 = var2.height; var1.translate(var2.x, var2.y); if (this.slider.isEnabled()) { var1.setColor(this.slider.getBackground()); } else { var1.setColor(this.slider.getBackground().darker()); } if (!this.slider.getPaintTicks()) { var1.fillRect(0, 0, var3, var4); var1.setColor(Color.black); var1.drawLine(0, var4 - 1, var3 - 1, var4 - 1); var1.drawLine(var3 - 1, 0, var3 - 1, var4 - 1); var1.setColor(this.highlightColor); var1.drawLine(0, 0, 0, var4 - 2); var1.drawLine(1, 0, var3 - 2, 0); var1.setColor(this.shadowColor); var1.drawLine(1, var4 - 2, var3 - 2, var4 - 2); var1.drawLine(var3 - 2, 1, var3 - 2, var4 - 3); } else if (this.slider.getOrientation() == 0) { int var5 = var3 / 2; var1.fillRect(1, 1, var3 - 3, var4 - 1 - var5); Polygon var6 = new Polygon(); var6.addPoint(1, var4 - var5); var6.addPoint(var5 - 1, var4 - 1); var6.addPoint(var3 - 2, var4 - 1 - var5); var1.fillPolygon(var6); var1.setColor(this.highlightColor); var1.drawLine(0, 0, var3 - 2, 0); var1.drawLine(0, 1, 0, var4 - 1 - var5); var1.drawLine(0, var4 - var5, var5 - 1, var4 - 1); var1.setColor(Color.black); var1.drawLine(var3 - 1, 0, var3 - 1, var4 - 2 - var5); var1.drawLine(var3 - 1, var4 - 1 - var5, var3 - 1 - var5, var4 - 1); var1.setColor(this.shadowColor); var1.drawLine(var3 - 2, 1, var3 - 2, var4 - 2 - var5); var1.drawLine(var3 - 2, var4 - 1 - var5, var3 - 1 - var5, var4 - 2); } else { int var7 = var4 / 2; var1.fillRect(1, 1, var3 - 1 - var7, var4 - 3); Polygon var8 = new Polygon(); var8.addPoint(var3 - var7 - 1, 0); var8.addPoint(var3 - 1, var7); var8.addPoint(var3 - 1 - var7, var4 - 2); var1.fillPolygon(var8); var1.setColor(this.highlightColor); var1.drawLine(0, 0, 0, var4 - 2); var1.drawLine(1, 0, var3 - 1 - var7, 0); var1.drawLine(var3 - var7 - 1, 0, var3 - 1, var7); var1.setColor(Color.black); var1.drawLine(0, var4 - 1, var3 - 2 - var7, var4 - 1); var1.drawLine(var3 - 1 - var7, var4 - 1, var3 - 1, var4 - 1 - var7); var1.setColor(this.shadowColor); var1.drawLine(1, var4 - 2, var3 - 2 - var7, var4 - 2); var1.drawLine(var3 - 1 - var7, var4 - 2, var3 - 2, var4 - var7 - 1); } var1.translate(-var2.x, -var2.y); } public void paintTicks(Graphics var1) { Rectangle var2 = this.tickRect; int var7 = var2.width; int var8 = var2.height; var1.setColor(this.slider.getBackground()); var1.fillRect(var2.x, var2.y, var2.width, var2.height); var1.setColor(Color.black); int var4 = this.slider.getMajorTickSpacing(); int var5 = this.slider.getMinorTickSpacing(); if (this.slider.getOrientation() == 0) { var1.translate(0, var2.y); int var11 = this.slider.getMinimum(); int var12 = 0; if (this.slider.getMinorTickSpacing() > 0) { while(var11 <= this.slider.getMaximum()) { var12 = this.xPositionForValue(var11); this.paintMinorTickForHorizSlider(var1, var2, var12); var11 += this.slider.getMinorTickSpacing(); } } if (this.slider.getMajorTickSpacing() > 0) { for(int var13 = this.slider.getMinimum(); var13 <= this.slider.getMaximum(); var13 += this.slider.getMajorTickSpacing()) { var12 = this.xPositionForValue(var13); this.paintMajorTickForHorizSlider(var1, var2, var12); } } var1.translate(0, -var2.y); } else { var1.translate(var2.x, 0); int var14 = this.slider.getMinimum(); int var18 = 0; if (this.slider.getMinorTickSpacing() > 0) { while(var14 <= this.slider.getMaximum()) { var18 = this.yPositionForValue(var14); this.paintMinorTickForVertSlider(var1, var2, var18); var14 += this.slider.getMinorTickSpacing(); } } if (this.slider.getMajorTickSpacing() > 0) { for(int var15 = this.slider.getMinimum(); var15 <= this.slider.getMaximum(); var15 += this.slider.getMajorTickSpacing()) { var18 = this.yPositionForValue(var15); this.paintMajorTickForVertSlider(var1, var2, var18); } } var1.translate(-var2.x, 0); } } public void paintTrack(Graphics var1) { Rectangle var7 = this.trackRect; if (this.slider.getOrientation() == 0) { int var6 = this.trackBuffer; int var3 = var7.height / 2 - 2; int var4 = var7.width; var1.translate(var7.x, var7.y + var3); var1.setColor(this.getShadowColor()); var1.drawLine(0, 0, var4 - 1, 0); var1.drawLine(0, 1, 0, 2); var1.setColor(this.getHighlightColor()); var1.drawLine(0, 3, var4, 3); var1.drawLine(var4, 0, var4, 3); var1.setColor(Color.black); var1.drawLine(1, 1, var4 - 2, 1); var1.translate(-var7.x, -(var7.y + var3)); } else { int var8 = this.trackBuffer; int var2 = var7.width / 2 - 2; int var5 = var7.height; var1.translate(var7.x + var2, var7.y); var1.setColor(this.getShadowColor()); var1.drawLine(0, 0, 0, var5 - 1); var1.drawLine(1, 0, 2, 0); var1.setColor(this.getHighlightColor()); var1.drawLine(3, 0, 3, var5); var1.drawLine(0, var5, 3, var5); var1.setColor(Color.black); var1.drawLine(1, 1, 1, var5 - 2); var1.translate(-(var7.x + var2), -var7.y); } } protected void paintVerticalLabel(Graphics var1, int var2, Component var3) { int var4 = this.yPositionForValue(var2); int var5 = var4 - var3.getPreferredSize().height / 2; var1.translate(0, var5); var3.paint(var1); var1.translate(0, -var5); } protected void recalculateIfInsetsChanged() { Insets var1 = this.slider.getInsets(); if (!var1.equals(this.insetCache)) { this.insetCache = var1; this.calculateGeometry(); } } public void scrollByBlock(int var1) { JSlider var2 = this.slider; synchronized(var2){} try { int var4 = this.slider.getValue(); int var5 = this.slider.getMaximum() / 10; int var6 = var5 * (var1 > 0 ? 1 : -1); this.slider.setValue(var4 + var6); } catch (Throwable var8) { throw var8; } } public void scrollByUnit(int var1) { JSlider var2 = this.slider; synchronized(var2){} try { int var4 = this.slider.getValue(); int var5 = var1 > 0 ? 1 : -1; this.slider.setValue(var4 + var5); } catch (Throwable var7) { throw var7; } } protected void scrollDueToClickInTrack(int var1) { this.scrollByBlock(var1); } public void setThumbLocation(int var1, int var2) { unionRect.setBounds(this.thumbRect); this.thumbRect.setLocation(var1, var2); SwingUtilities.computeUnion(this.thumbRect.x, this.thumbRect.y, this.thumbRect.width, this.thumbRect.height, unionRect); this.slider.repaint(unionRect.x, unionRect.y, unionRect.width, unionRect.height); } protected void uninstallKeyboardActions(JSlider var1) { ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke(39, 0)); ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke("KP_RIGHT")); ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke(40, 0)); ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke("KP_DOWN")); ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke(34, 0)); ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke(37, 0)); ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke("KP_LEFT")); ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke(38, 0)); ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke("KP_UP")); ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke(33, 0)); ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke(36, 0)); ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke(35, 0)); } protected void uninstallListeners(JSlider var1) { ((Component)var1).removeMouseListener(this.trackListener); ((Component)var1).removeMouseMotionListener(this.trackListener); ((Component)var1).removeFocusListener(this.focusListener); ((Component)var1).removeComponentListener(this.componentListener); ((JComponent)var1).removePropertyChangeListener(this.propertyChangeListener); var1.getModel().removeChangeListener(this.changeListener); } public void uninstallUI(JComponent var1) { if (var1 != this.slider) { throw new IllegalComponentStateException(String.valueOf(this) + " was asked to deinstall() " + var1 + " when it only knows about " + this.slider + "."); } else { LookAndFeel.uninstallBorder(this.slider); this.scrollTimer.stop(); this.scrollTimer = null; this.uninstallListeners(this.slider); this.uninstallKeyboardActions(this.slider); this.focusInsets = null; this.insetCache = null; this.focusRect = null; this.contentRect = null; this.labelRect = null; this.tickRect = null; this.trackRect = null; this.thumbRect = null; this.trackListener = null; this.changeListener = null; this.componentListener = null; this.focusListener = null; this.scrollListener = null; this.propertyChangeListener = null; this.slider = null; } } public int valueForXPosition(int var1) { int var3 = this.slider.getMinimum(); int var4 = this.slider.getMaximum(); int var5 = this.trackRect.width; int var6 = this.trackRect.x; int var7 = this.trackRect.x + (this.trackRect.width - 1); int var2; if (var1 <= var6) { var2 = this.slider.getInverted() ? var4 : var3; } else if (var1 >= var7) { var2 = this.slider.getInverted() ? var3 : var4; } else { int var8 = var1 - var6; int var9 = var4 - var3; double var10 = (double)var9 / (double)var5; int var12 = (int)Math.round((double)var8 * var10); var2 = this.slider.getInverted() ? var4 - var12 : var3 + var12; } return var2; } public int valueForYPosition(int var1) { int var3 = this.slider.getMinimum(); int var4 = this.slider.getMaximum(); int var5 = this.trackRect.height; int var6 = this.trackRect.y; int var7 = this.trackRect.y + (this.trackRect.height - 1); int var2; if (var1 <= var6) { var2 = this.slider.getInverted() ? var3 : var4; } else if (var1 >= var7) { var2 = this.slider.getInverted() ? var4 : var3; } else { int var8 = var1 - var6; int var9 = var4 - var3; double var10 = (double)var9 / (double)var5; int var12 = (int)Math.round((double)var8 * var10); var2 = this.slider.getInverted() ? var3 + var12 : var4 - var12; } return var2; } protected int xPositionForValue(int var1) { int var2 = this.slider.getMinimum(); int var3 = this.slider.getMaximum(); int var4 = this.trackRect.width; int var5 = this.slider.getMaximum() - this.slider.getMinimum(); double var6 = (double)var4 / (double)var5; int var8 = this.trackRect.x; int var9 = this.trackRect.x + (this.trackRect.width - 1); int var10; if (!this.slider.getInverted()) { var10 = (int)((long)var8 + Math.round(var6 * (double)(var1 - var2))); } else { var10 = (int)((long)var9 - Math.round(var6 * (double)(var1 - var2))); } var10 = Math.max(var8, var10); var10 = Math.min(var9, var10); return var10; } protected int yPositionForValue(int var1) { int var2 = this.slider.getMinimum(); int var3 = this.slider.getMaximum(); int var4 = this.trackRect.height; int var5 = this.slider.getMaximum() - this.slider.getMinimum(); double var6 = (double)var4 / (double)var5; int var8 = this.trackRect.y; int var9 = this.trackRect.y + (this.trackRect.height - 1); int var10; if (!this.slider.getInverted()) { var10 = (int)((long)var8 + Math.round(var6 * (double)(var3 - var1))); } else { var10 = (int)((long)var8 + Math.round(var6 * (double)(var1 - var2))); } var10 = Math.max(var8, var10); var10 = Math.min(var9, var10); return var10; } }